import type { RouteRecordRaw } from "vue-router";
/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      hidden：        是否隐藏此路由
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */

/**
 * 静态路由（默认路由）
 */
export const staticRoutes: Array<RouteRecordRaw> = [
  // 登录的路由
  {
    path: "/login",
    name: "Login",
    component: () => import("@/views/login/index.vue"),
    meta: {
      hidden: true,
    },
  },
  // 404的路由
  {
    path: "/404",
    name: "404",
    component: () => import("@/views/error/404.vue"),
    meta: {
      hidden: true,
    },
  },
  // 首页的路由
  {
    path: "/",
    component: () => import("@/layout/index.vue"),
    redirect: "/home",
    children: [
      {
        path: "home",
        name: "Home",
        component: () => import("@/views/home/index.vue"),
        meta: {
          title: "首页",
          icon: "ele-HomeFilled",
        },
      },
    ],
  },
  {
    name: "Acl",
    path: "/acl",
    component: () => import("@/layout/index.vue"),
    redirect: "/acl/user/list", //重定向
    meta: { title: "权限管理", icon: "ele-Setting" },
    children: [
      {
        name: "User",
        path: "/user/list",
        component: () => import("@/views/acl/user/index.vue"),
        meta: {
          title: "用户管理",
        },
      },
      {
        name: 'Role',
        path: '/acl/role/list',
        component: () => import('@/views/acl/role/index.vue'),
        meta: {
          title: '角色管理',
        },
      },
    ],
  },
  {
    name: 'Product',
    path: '/product',
    component: () => import('@/layout/index.vue'),
    redirect: '/product/category/list', // 重新定向,
    meta: {
      title: '商品管理',
      icon: 'ele-ShoppingBag'
    },
    children: [
      {
        name: 'Category',
        path: '/product/category/list',
        component: () => import('@/views/product/category/index.vue'),
        meta: { title: '分类管理' }
      },
  {
    name: 'Trademark',
    path: '/product/trademark/list',
    component: () => import('@/views/product/trademark/index.vue'),
    meta: { title: '品牌管理' }
  },
]
  },
  /* 匹配任意的路由 必须最后注册 */
  {
    path: "/:pathMatch(.*)",
    name: "Any",
    redirect: "/404",
    meta: {
      hidden: true,
    },
  },
];
/**
 *  异步路由(定义动态路由)
 */
// export const allAsyncRoutes: Array<RouteRecordRaw> = [
//   // 权限管理路由
 
// ];
// 任意路由
export const anyRoute: RouteRecordRaw = {
  path: "/:pathMatch(.*)",
  name: "Any",
  redirect: "/404",
  meta: {
    hidden: true,
  },
};
